<?php
	namespace Admin\Controller;
	/**
	 * 后台相册管理控制器类
	 */
	class PhotoController extends BaseController {
		/**
		 * 展示管理相册首页
		 */
		public function photo() {
			$model = D('Photo');
			$photoData = $model->getPhotoList();
			
			$this->assign('photoData', $photoData);
			$this->display();
		}
		
		/**
		 * 展示照片添加界面
		 */
		public function add() {
			$this->display();
		}
		
		/**
		 * 处理照片上传
		 */
		public function dealAdd() {
			// 接收数据
			$post = I('post.');
			$file = $_FILES['photo'];
			
			$model = D('Photo');
			$result = $model->addPhoto($post,$file);
			if($result) {
				$this->success('上传成功');
			}else {
				$this->error('上传失败');
			}
		}
	}
